package Test;
class Node2{
    private static volatile Node2 str=null;
    private Node2(){

    }

    public static Node2 getNode2(){
        if(str==null){
            synchronized (Node2.class){
                if(str==null){
                    str=new Node2();
                }
            }
        }
        return str;
    }
}
public class Demo2 {
    public static void main(String[] args) {
        Node2 node=Node2.getNode2();
    }
}
